package com.jishuo.nontax.view.controller;

import com.jishuo.base.annotation.UserAuthority;
import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.bean.vo.UserVO;
import com.jishuo.nontax.bean.vo.EticketNumVO;
import com.jishuo.nontax.bfc.service.EticketNumService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * @auther dinggaofei
 * @Date 2023/3/23 16:23
 */
@Slf4j
@Controller
@RequestMapping(value = "/view/eticket", name = "电子缴款")
@UserAuthority(menu = {"/view/eticketnumview"})
public class EticketNumViewController {

    @Resource
    private EticketNumService eticketNumService;

    private String prefix = "view/";

    @RequestMapping(value = {"eticketnumview"}, name = "电子缴款")
    public String index(@PathVariable(required = false) String page) {
        return prefix + "eticketnumview";
    }

    @ResponseBody
    @RequestMapping(value = "eticketNumData", name = "电子缴款信息")
    public BaseResult eticketNumData(String billnum) {
        return eticketNumService.getEticketNumVO(billnum);
    }

    @ResponseBody
    @RequestMapping(value = "eticketNumpayview",name = "电子缴款付款")
    public BaseResult eticketNumpayview(EticketNumVO eticketNumVO, HttpSession session){
        UserVO user = (UserVO) session.getAttribute("login_user");
        // 设置网点
        eticketNumVO.setBankstation(user.getBankStationName());
        return  eticketNumService.eticketnumpayview(eticketNumVO);
    }
}
